

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="Docutils 0.19: https://docutils.sourceforge.io/" />

  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  
  <title>多站 &mdash; Ceph Documentation</title>
  

  
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/ceph.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/graphviz.css" type="text/css" />
  <link rel="stylesheet" href="../../_static/css/custom.css" type="text/css" />

  
  

  
  

  

  
  <!--[if lt IE 9]>
    <script src="../../_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/jquery.js"></script>
        <script src="../../_static/_sphinx_javascript_frameworks_compat.js"></script>
        <script data-url_root="../../" id="documentation_options" src="../../_static/documentation_options.js"></script>
        <script src="../../_static/doctools.js"></script>
        <script src="../../_static/sphinx_highlight.js"></script>
    
    <script type="text/javascript" src="../../_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="../../genindex/" />
    <link rel="search" title="Search" href="../../search/" />
    <link rel="next" title="Zone Features" href="../zone-features/" />
    <link rel="prev" title="HTTP 前端" href="../frontends/" /> 
</head>

<body class="wy-body-for-nav">

   
  <header class="top-bar">
    <div role="navigation" aria-label="Page navigation">
  <ul class="wy-breadcrumbs">
      <li><a href="../../" class="icon icon-home" aria-label="Home"></a></li>
          <li class="breadcrumb-item"><a href="../">Ceph 对象网关</a></li>
      <li class="breadcrumb-item active">多站</li>
      <li class="wy-breadcrumbs-aside">
            <a href="../../_sources/radosgw/multisite.rst.txt" rel="nofollow"> View page source</a>
      </li>
  </ul>
  <hr/>
</div>
  </header>
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search"  style="background: #eee" >
          

          
            <a href="../../" class="icon icon-home"> Ceph
          

          
          </a>

          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="../../search/" method="get">
    <input type="text" name="q" placeholder="Search docs" aria-label="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul class="current">
<li class="toctree-l1"><a class="reference internal" href="../../start/">Ceph 简介</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../install/">安装 Ceph</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephadm/">Cephadm</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rados/">Ceph 存储集群</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../cephfs/">Ceph 文件系统</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../rbd/">Ceph 块设备</a></li>
<li class="toctree-l1 current"><a class="reference internal" href="../">Ceph 对象网关</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="../frontends/">HTTP 前端</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="#">多站配置</a><ul>
<li class="toctree-l3"><a class="reference internal" href="#id2">单域配置和多站配置</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id3">单域配置</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id4">多站配置的种类</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id5">示意图 - 域之间对象数据的复制</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#infernalis">从 Infernalis 以来功能上的变化</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id6">环境需求和假设</a></li>
<li class="toctree-l3"><a class="reference internal" href="#master-zone-label">配置主域</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#realm">创建 realm</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id8">创建主域组</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id9">创建主域</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id10">删除默认域组和域</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id11">创建系统用户</a></li>
<li class="toctree-l4"><a class="reference internal" href="#period">更新 period</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id12">更新 Ceph 配置文件</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id13">启动网关</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#secondary-zone-label">配置副域</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id15">拉取 realm</a></li>
<li class="toctree-l4"><a class="reference internal" href="#radosgw-multisite-secondary-zone-creating">创建副域</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id17">更新 Ceph 配置文件</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id18">更新 period</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id19">启动网关</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id20">检查同步状态</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id21">对象的校验</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#id22">维护</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id23">检查同步状态</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id24">检查日志</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id25">更改元数据主域</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#id26">故障切换和灾难恢复</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#id27">故障切换到副域的配置</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id28">从故障切换回退</a></li>
</ul>
</li>
<li class="toctree-l3"><a class="reference internal" href="#rgw-multisite-migrate-from-single-site">从单站迁移到多站配置</a></li>
<li class="toctree-l3"><a class="reference internal" href="#id31">多站配置参考</a><ul>
<li class="toctree-l4"><a class="reference internal" href="#realms">Realms</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id40">域组</a></li>
<li class="toctree-l4"><a class="reference internal" href="#radosgw-zones">域</a></li>
<li class="toctree-l4"><a class="reference internal" href="#id61">域组和域选项</a></li>
</ul>
</li>
</ul>
</li>
<li class="toctree-l2"><a class="reference internal" href="../zone-features/">域的功能</a></li>
<li class="toctree-l2"><a class="reference internal" href="../placement/">存储池归置与存储类</a></li>
<li class="toctree-l2"><a class="reference internal" href="../multisite-sync-policy/">多站同步策略配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../pools/">存储池的配置</a></li>
<li class="toctree-l2"><a class="reference internal" href="../config-ref/">配置参考</a></li>
<li class="toctree-l2"><a class="reference internal" href="../admin/">管理指南</a></li>
<li class="toctree-l2"><a class="reference internal" href="../account/">用户账户</a></li>
<li class="toctree-l2"><a class="reference internal" href="../s3/">S3 API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../iam/">IAM API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../rgw-cache/">数据缓存和 CDN</a></li>
<li class="toctree-l2"><a class="reference internal" href="../swift/">Swift API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../adminops/">管理操作 API</a></li>
<li class="toctree-l2"><a class="reference internal" href="../api/">Python 接口</a></li>
<li class="toctree-l2"><a class="reference internal" href="../nfs/">通过 NFS 导出</a></li>
<li class="toctree-l2"><a class="reference internal" href="../keystone/">与 OpenStack Keystone 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../barbican/">与 OpenStack Barbican 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../vault/">与 HashiCorp Vault 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../kmip/">与 KMIP 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../opa/">与 Open Policy Agent 对接</a></li>
<li class="toctree-l2"><a class="reference internal" href="../multitenancy/">多租户</a></li>
<li class="toctree-l2"><a class="reference internal" href="../compression/">压缩</a></li>
<li class="toctree-l2"><a class="reference internal" href="../ldap-auth/">LDAP 认证</a></li>
<li class="toctree-l2"><a class="reference internal" href="../encryption/">服务器端加密</a></li>
<li class="toctree-l2"><a class="reference internal" href="../bucketpolicy/">桶策略</a></li>
<li class="toctree-l2"><a class="reference internal" href="../dynamicresharding/">动态的桶索引重分片</a></li>
<li class="toctree-l2"><a class="reference internal" href="../mfa/">多因子认证</a></li>
<li class="toctree-l2"><a class="reference internal" href="../sync-modules/">同步模块</a></li>
<li class="toctree-l2"><a class="reference internal" href="../notifications/">Bucket Notifications</a></li>
<li class="toctree-l2"><a class="reference internal" href="../layout/">RADOS 中的数据布局</a></li>
<li class="toctree-l2"><a class="reference internal" href="../STS/">STS</a></li>
<li class="toctree-l2"><a class="reference internal" href="../STSLite/">STS Lite</a></li>
<li class="toctree-l2"><a class="reference internal" href="../keycloak/">Keycloak</a></li>
<li class="toctree-l2"><a class="reference internal" href="../session-tags/">Session Tags</a></li>
<li class="toctree-l2"><a class="reference internal" href="../role/">Role</a></li>
<li class="toctree-l2"><a class="reference internal" href="../orphans/">Orphan List and Associated Tooliing</a></li>
<li class="toctree-l2"><a class="reference internal" href="../oidc/">OpenID Connect Provider</a></li>
<li class="toctree-l2"><a class="reference internal" href="../troubleshooting/">故障排除</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../man/8/radosgw/">radosgw 手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../../man/8/radosgw-admin/">radosgw-admin 手册页</a></li>
<li class="toctree-l2"><a class="reference internal" href="../qat-accel/">使用 QAT 为加密和压缩提速</a></li>
<li class="toctree-l2"><a class="reference internal" href="../s3select/">S3-select</a></li>
<li class="toctree-l2"><a class="reference internal" href="../lua-scripting/">Lua Scripting</a></li>
<li class="toctree-l2"><a class="reference internal" href="../d3n_datacache/">D3N Data Cache</a></li>
<li class="toctree-l2"><a class="reference internal" href="../cloud-transition/">Cloud Transition</a></li>
<li class="toctree-l2"><a class="reference internal" href="../metrics/">Metrics</a></li>
<li class="toctree-l2"><a class="reference internal" href="../uadk-accel/">UADK Acceleration for Compression</a></li>
<li class="toctree-l2"><a class="reference internal" href="../bucket_logging/">桶的日志记录</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/">Ceph 管理器守护进程</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../mgr/dashboard/">Ceph 仪表盘</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../monitoring/">监控概览</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../api/">API 文档</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../architecture/">体系结构</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/developer_guide/">开发者指南</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../dev/internals/">Ceph 内幕</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../governance/">项目管理</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../foundation/">Ceph 基金会</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../ceph-volume/">ceph-volume</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/general/">Ceph 版本（总目录）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../releases/">Ceph 版本（索引）</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../security/">Security</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../hardware-monitoring/">硬件监控</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../glossary/">Ceph 术语</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../jaegertracing/">Tracing</a></li>
<li class="toctree-l1"><a class="reference internal" href="../../translation_cn/">中文版翻译资源</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="../../">Ceph</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
<div id="dev-warning" class="admonition note">
  <p class="first admonition-title">Notice</p>
  <p class="last">This document is for a development version of Ceph.</p>
</div>
  <div id="docubetter" align="right" style="padding: 5px; font-weight: bold;">
    <a href="https://pad.ceph.com/p/Report_Documentation_Bugs">Report a Documentation Bug</a>
  </div>

  
  <section id="multisite">
<span id="id1"></span><h1>多站<a class="headerlink" href="#multisite" title="Permalink to this heading"></a></h1>
<section id="id2">
<h2>单域配置和多站配置<a class="headerlink" href="#id2" title="Permalink to this heading"></a></h2>
<section id="id3">
<h3>单域配置<a class="headerlink" href="#id3" title="Permalink to this heading"></a></h3>
<p>单个域的配置通常包括两个东西：</p>
<ol class="arabic simple">
<li><p>一个域组（ zonegroup ），其内有一个域。</p></li>
<li><p>一或多个 <cite>ceph-radosgw</cite> 例程，可以对客户端请求做负载均衡。</p></li>
</ol>
<p>在典型的单域配置中，会有多个
<cite>ceph-radosgw</cite> 例程使用同一个 Ceph 存储集群。</p>
</section>
<section id="id4">
<h3>多站配置的种类<a class="headerlink" href="#id4" title="Permalink to this heading"></a></h3>
<div class="versionadded">
<p><span class="versionmodified added">New in version Jewel.</span></p>
</div>
<p>从 Kraken 版起， Ceph 逐步能够支持好几种对象网关的多站配置方案：</p>
<ul>
<li><p><strong>多域（ Multi-zone ）：</strong> “多域”配置具有复杂的拓扑结构。
一套多域配置由一个域组和多个域组成。每个域由一或多个 <cite>ceph-radosgw</cite> 例程组成，
<strong>每个域都由它自己的 Ceph 存储集群支撑。</strong></p>
<p>一个域组内存在多个域是为了让这个域组具备灾难恢复能力，
在其中一个域出现重大故障时有能力恢复。
每个域都处于活跃状态，可处理写操作。
一套包含多个活跃域的多域配置可增强灾难恢复能力，
还可以用作内容分发网络的底层。</p>
</li>
<li><p><strong>多个域组（ Multi-zonegroups ）：</strong> Ceph 对象网关也支持多个域组，
以前称为“region”。每个域组内可以有一或多个域。
如果两个域处于同一域组，而且这个域组与第二个域组处于同一个 realm ，
那么这两个域中存储的对象共享一个全局对象命名空间。
这个全局对象名称空间可确保跨域组和跨域的对象 ID 具有唯一性。</p>
<p>每个桶都归它创建时所在的域组所有
（除非在创建桶时被 <a class="reference internal" href="../placement/#s3-bucket-placement"><span class="std std-ref">LocationConstraint</span></a> 改写），
其对象数据只能复制到该域组中的其他域。
所有发送到其他域组的、目标是该桶中数据的请求，
都会重定向到这个桶所在的域组。</p>
<p>当你想跨越多个域组共享用户和桶的命名空间，
并把对象数据隔离在少数几个域时，
创建多个域组就很有用。假设你有几个连接在一起的站点，
它们共享存储空间，但出于灾难恢复的目的，只需要一个备份。
在这种情况下，可以创建几个域组，每个域组只有两个域，
以免把所有对象都复制到所有区域。</p>
<p>在其他情况下，你可能会将数据隔离在不同的 realm 中，
每个 realm 只有一个域组。通过分别控制数据和元数据的隔离，
域组实现了灵活性。</p>
</li>
<li><p><strong>多个 realm ：</strong> 从 Kraken 版起， Ceph 对象网关支持
realm 概念，它是域组的容器。
有了 realm ，就可以实现为多个域组设置统一的策略。
realm 有个全局唯一的命名空间，可以包含单个域组或多个域组。
如果你决定使用多个 realm ，
就可以定义多个命名空间和多套配置
（这意味着每个 realm 都可以有不同于其他 realm 的一套配置）。</p></li>
</ul>
</section>
<section id="id5">
<h3>示意图 - 域之间对象数据的复制<a class="headerlink" href="#id5" title="Permalink to this heading"></a></h3>
<p>同一域组内、两个域之间的数据复制情形如下：</p>
<img alt="../../_images/zone-sync.svg" class="align-center" src="../../_images/zone-sync.svg" /><p>在本图的顶部，我们可以看到两个应用程序（也称为“客户端”）。
右边的应用程序通过 RADOS 网关 (RGW) 从 Ceph 集群写入和读出数据。
左边的应用程序只通过 RADOS 网关 (RGW) 实例从 Ceph 集群读出数据。
在这两种情况下（读写和只读），
数据传输都是按照 REST 规范处理的。</p>
<p>在图表的中间，有两个域，每个域都包含一个
RADOS 网关 (RGW) 实例。这些 RGW 实例负责处理从应用程序到域组的数据传输。
从主域（ US-EAST ）到辅域（ US-WEST ）的箭头表示数据同步行为。</p>
<p>在本图的底部，我们看到，数据分发进了 Ceph 存储集群。</p>
<p>网关集群的配置细节请参考<a class="reference external" href="https://access.redhat.com/documentation/en-us/red_hat_ceph_storage/3/html/ceph_object_gateway_for_production/index/">生产级的 Ceph 对象网关</a> 。</p>
</section>
</section>
<section id="infernalis">
<h2>从 Infernalis 以来功能上的变化<a class="headerlink" href="#infernalis" title="Permalink to this heading"></a></h2>
<p>从 Kraken 版起，各个 Ceph 对象网关可以配置成处于多活域模式（ active-active zone mode ）下，这样就可以写入非主域。</p>
<p>多站配置信息存储在名为 realm 的容器内，realm 内存储着域组、域、和带有多个时间结的 peroid ，时间结用于跟踪配置变更。</p>
<p>从 Kraken 版起，由 <code class="docutils literal notranslate"><span class="pre">ceph-radosgw</span></code> 守护进程处理数据的跨域同步，无需再单独配置同步代理。
新同步方法允许 Ceph 对象网关以多活（ active-active ）模式运行，不再是主从（ active-passive ）模式。</p>
</section>
<section id="id6">
<h2>环境需求和假设<a class="headerlink" href="#id6" title="Permalink to this heading"></a></h2>
<p>一套多站配置需要至少两个 Ceph 存储集群，
至少两个 Ceph 对象网关例程，分别连接两个 Ceph 存储集群。</p>
<p>本指南中，我们假设至少有两个地理位置不同的 Ceph 存储集群，
其实都在本地也能跑通；
还假设有两个 Ceph 对象网关服务器，
分别名为 <code class="docutils literal notranslate"><span class="pre">rgw1</span></code> 和 <code class="docutils literal notranslate"><span class="pre">rgw2</span></code> 。</p>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p><strong>不建议</strong>运营单个跨地理区域的 Ceph 存储集群，除非你的 WAN 连接延时够低。</p>
</div>
<p>一套多站配置必须有一个主域组和一个主域，
各域组都得有自己的主域；
域组可以有一或多个副域组、副域。</p>
<p>在本指南中， <code class="docutils literal notranslate"><span class="pre">rgw1</span></code> 主机将在主域组的主域中提供服务；
而 <code class="docutils literal notranslate"><span class="pre">rgw2</span></code> 主机将在主域组的副域中提供服务。</p>
<p>为 Ceph 对象存储服务创建和调整存储池的文档请参考<a class="reference external" href="../pools">存储池</a>。</p>
<p><a class="reference external" href="../multisite-sync-policy">同步策略配置</a> 里会指引你如何定义粒度合适的桶同步策略的规则。</p>
</section>
<section id="master-zone-label">
<span id="id7"></span><h2>配置主域<a class="headerlink" href="#master-zone-label" title="Permalink to this heading"></a></h2>
<p>在多站配置中，所有网关都会向主域组中、主域内的
<code class="docutils literal notranslate"><span class="pre">ceph-radosgw</span></code> 守护进程索取配置。
所以在多站配置中，要配置各网关，需要挑一个 <code class="docutils literal notranslate"><span class="pre">ceph-radosgw</span></code> 例程，
在它上面配置主域组和主域。</p>
<section id="realm">
<h3>创建 realm<a class="headerlink" href="#realm" title="Permalink to this heading"></a></h3>
<p>realm 包含域组和域的多站配置信息，同时在 realm 内强制施行全局唯一的命名空间。</p>
<ol class="arabic">
<li><p>在为主域组和域提供服务的主机上，打开命令行，
执行下列命令创建多站配置所需的新 realm:</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><style type="text/css">
span.prompt1:before {
  content: "# ";
}
</style><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>create<span class="w"> </span>--rgw-realm<span class="o">={</span>realm-name<span class="o">}</span><span class="w"> </span><span class="o">[</span>--default<span class="o">]</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>create<span class="w"> </span>--rgw-realm<span class="o">=</span>movies<span class="w"> </span>--default</span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>如果此集群上只会配置一个 realm ，可加上 <code class="docutils literal notranslate"><span class="pre">--default</span></code> 标记。</p>
<p>指定 <code class="docutils literal notranslate"><span class="pre">--default</span></code> 以后， <code class="docutils literal notranslate"><span class="pre">radosgw-admin</span></code> 就会默认使用这个 realm ；</p>
<p>如果没指定 <code class="docutils literal notranslate"><span class="pre">--default</span></code> ，新增域组和域时就必须指定
<code class="docutils literal notranslate"><span class="pre">--rgw-realm</span></code> 或 <code class="docutils literal notranslate"><span class="pre">--realm-id</span></code> 标记，以确定在哪个 realm 新建。</p>
</div>
</li>
<li><p>创建 realm 后， <code class="docutils literal notranslate"><span class="pre">radosgw-admin</span></code> 会顺便显示此 realm 的配置信息，例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
    <span class="s2">&quot;id&quot;</span><span class="p">:</span> <span class="s2">&quot;0956b174-fe14-4f97-8b50-bb7ec5e1cf62&quot;</span><span class="p">,</span>
    <span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;movies&quot;</span><span class="p">,</span>
    <span class="s2">&quot;current_period&quot;</span><span class="p">:</span> <span class="s2">&quot;1950b710-3e63-4c41-a19e-46a715000980&quot;</span><span class="p">,</span>
    <span class="s2">&quot;epoch&quot;</span><span class="p">:</span> <span class="mi">1</span>
<span class="p">}</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Ceph 会给这个 realm 生成唯一的 ID ，这样，需要的话可以随时改名。</p>
</div>
</li>
</ol>
</section>
<section id="id8">
<h3>创建主域组<a class="headerlink" href="#id8" title="Permalink to this heading"></a></h3>
<p>一个 realm 必须至少有一个域组，只有一个的话它将作为此 realm 的主域组。</p>
<ol class="arabic">
<li><p>在为主域组和域提供服务的主机上，打开命令行，
执行下列命令新建多站配置所需的主域组：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>create<span class="w"> </span>--rgw-zonegroup<span class="o">={</span>name<span class="o">}</span><span class="w"> </span>--endpoints<span class="o">={</span>url<span class="o">}</span><span class="w"> </span><span class="o">[</span>--rgw-realm<span class="o">={</span>realm-name<span class="o">}</span><span class="p">|</span>--realm-id<span class="o">={</span>realm-id<span class="o">}]</span><span class="w"> </span>--master<span class="w"> </span>--default</span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>create<span class="w"> </span>--rgw-zonegroup<span class="o">=</span>us<span class="w"> </span>--endpoints<span class="o">=</span>http://rgw1:80<span class="w"> </span>--rgw-realm<span class="o">=</span>movies<span class="w"> </span>--master<span class="w"> </span>--default</span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>如果这个 realm 只有一个域组，创建时可加上 <code class="docutils literal notranslate"><span class="pre">--default</span></code> 标记。</p>
<p>指定 <code class="docutils literal notranslate"><span class="pre">--default</span></code> 后， <code class="docutils literal notranslate"><span class="pre">radosgw-admin</span></code> 在创建新域时将默认使用此域组。</p>
<p>如果未指定 <code class="docutils literal notranslate"><span class="pre">--default</span></code> 标记，新增或修改域时就得指定
<code class="docutils literal notranslate"><span class="pre">--rgw-zonegroup</span></code> 或 <code class="docutils literal notranslate"><span class="pre">--zonegroup-id</span></code> 标记，以确定在哪个域组内操作。</p>
</div>
</li>
<li><p>创建主域组后， <code class="docutils literal notranslate"><span class="pre">radosgw-admin</span></code> 会显示这个域组的配置，例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
    <span class="s2">&quot;id&quot;</span><span class="p">:</span> <span class="s2">&quot;f1a233f5-c354-4107-b36c-df66126475a6&quot;</span><span class="p">,</span>
    <span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;us&quot;</span><span class="p">,</span>
    <span class="s2">&quot;api_name&quot;</span><span class="p">:</span> <span class="s2">&quot;us&quot;</span><span class="p">,</span>
    <span class="s2">&quot;is_master&quot;</span><span class="p">:</span> <span class="s2">&quot;true&quot;</span><span class="p">,</span>
    <span class="s2">&quot;endpoints&quot;</span><span class="p">:</span> <span class="p">[</span>
        <span class="s2">&quot;http:\/\/rgw1:80&quot;</span>
    <span class="p">],</span>
    <span class="s2">&quot;hostnames&quot;</span><span class="p">:</span> <span class="p">[],</span>
    <span class="s2">&quot;hostnames_s3website&quot;</span><span class="p">:</span> <span class="p">[],</span>
    <span class="s2">&quot;master_zone&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
    <span class="s2">&quot;zones&quot;</span><span class="p">:</span> <span class="p">[],</span>
    <span class="s2">&quot;placement_targets&quot;</span><span class="p">:</span> <span class="p">[],</span>
    <span class="s2">&quot;default_placement&quot;</span><span class="p">:</span> <span class="s2">&quot;&quot;</span><span class="p">,</span>
    <span class="s2">&quot;realm_id&quot;</span><span class="p">:</span> <span class="s2">&quot;0956b174-fe14-4f97-8b50-bb7ec5e1cf62&quot;</span>
<span class="p">}</span>
</pre></div>
</div>
</li>
</ol>
</section>
<section id="id9">
<h3>创建主域<a class="headerlink" href="#id9" title="Permalink to this heading"></a></h3>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>域必须在此域内的 Ceph 对象网关所在节点上创建。</p>
</div>
<p>在为主域组和域提供服务的主机上，
打开命令行，执行下列命令新建多站配置所需的主域：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1"><span class="c1"># radosgw-admin zone create --rgw-zonegroup={zone-group-name} \</span>
<span class="w">                             </span>--rgw-zone<span class="o">={</span>zone-name<span class="o">}</span><span class="w"> </span><span class="se">\</span>
<span class="w">                             </span>--master<span class="w"> </span>--default<span class="w"> </span><span class="se">\</span>
<span class="w">                             </span>--endpoints<span class="o">={</span>http://fqdn<span class="o">}[</span>,<span class="o">{</span>http://fqdn<span class="o">}]</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1"><span class="c1"># radosgw-admin zone create --rgw-zonegroup=us --rgw-zone=us-east \</span>
<span class="w">                             </span>--master<span class="w"> </span>--default<span class="w"> </span><span class="se">\</span>
<span class="w">                             </span>--endpoints<span class="o">={</span>http://fqdn<span class="o">}[</span>,<span class="o">{</span>http://fqdn<span class="o">}]</span></span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>这里没有指定 <code class="docutils literal notranslate"><span class="pre">--access-key</span></code> 和 <code class="docutils literal notranslate"><span class="pre">--secret</span></code> ，
在后面的章节中创建用户后，再把这些配置写入域。</p>
</div>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>后续步骤假设是在新安装好的系统上实施多站配置，
上面还没有数据。如果你已经用它存储了一些数据，
<strong>不要删除</strong> <code class="docutils literal notranslate"><span class="pre">default</span></code> 域及其存储池，
否则数据会被删除且不可恢复。</p>
</div>
</section>
<section id="id10">
<h3>删除默认域组和域<a class="headerlink" href="#id10" title="Permalink to this heading"></a></h3>
<ol class="arabic">
<li><p>如果有 <code class="docutils literal notranslate"><span class="pre">default</span></code> 域，要先从域组里删除，然后再删掉它。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>delete<span class="w"> </span>--rgw-zonegroup<span class="o">=</span>default<span class="w"> </span>--rgw-zone<span class="o">=</span>default</span>
<span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
<span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>delete<span class="w"> </span>--rgw-zone<span class="o">=</span>default</span>
<span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
<span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>delete<span class="w"> </span>--rgw-zonegroup<span class="o">=</span>default</span>
<span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></li>
<li><p>如果这个 Ceph 存储集群里还有 <code class="docutils literal notranslate"><span class="pre">default</span></code> 存储池，也需一并删除。</p>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>后续步骤假设是在新安装好的系统上实施多站配置，
上面还没有数据。如果你已经用它存储了一些数据，
<strong>不要删除</strong> <code class="docutils literal notranslate"><span class="pre">default</span></code> 域及其存储池，否则数据会被删除且不可恢复。</p>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>default.rgw.control<span class="w"> </span>default.rgw.control<span class="w"> </span>--yes-i-really-really-mean-it</span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>default.rgw.data.root<span class="w"> </span>default.rgw.data.root<span class="w"> </span>--yes-i-really-really-mean-it</span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>default.rgw.gc<span class="w"> </span>default.rgw.gc<span class="w"> </span>--yes-i-really-really-mean-it</span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>default.rgw.log<span class="w"> </span>default.rgw.log<span class="w"> </span>--yes-i-really-really-mean-it</span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>default.rgw.users.uid<span class="w"> </span>default.rgw.users.uid<span class="w"> </span>--yes-i-really-really-mean-it</span>
</pre></div></div></li>
</ol>
</section>
<section id="id11">
<h3>创建系统用户<a class="headerlink" href="#id11" title="Permalink to this heading"></a></h3>
<ol class="arabic">
<li><p><code class="docutils literal notranslate"><span class="pre">ceph-radosgw</span></code> 守护进程在拉取 realm 和 peroid 信息前必须先通过认证。
在主域里，创建一个系统用户，用于守护进程之间的认证。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>user<span class="w"> </span>create<span class="w"> </span>--uid<span class="o">=</span><span class="s2">&quot;{user-name}&quot;</span><span class="w"> </span>--display-name<span class="o">=</span><span class="s2">&quot;{Display Name}&quot;</span><span class="w"> </span>--system</span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>user<span class="w"> </span>create<span class="w"> </span>--uid<span class="o">=</span><span class="s2">&quot;synchronization-user&quot;</span><span class="w"> </span>--display-name<span class="o">=</span><span class="s2">&quot;Synchronization User&quot;</span><span class="w"> </span>--system</span>
</pre></div></div></li>
<li><p>记下 <code class="docutils literal notranslate"><span class="pre">access_key</span></code> 和 <code class="docutils literal notranslate"><span class="pre">secret_key</span></code> 的内容，因为副域需要用它们与主域认证。</p></li>
<li><p>把系统用户加入主域。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>modify<span class="w"> </span>--rgw-zone<span class="o">={</span>zone-name<span class="o">}</span><span class="w"> </span>--access-key<span class="o">={</span>access-key<span class="o">}</span><span class="w"> </span>--secret<span class="o">={</span>secret<span class="o">}</span></span>
<span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></li>
</ol>
</section>
<section id="period">
<h3>更新 period<a class="headerlink" href="#period" title="Permalink to this heading"></a></h3>
<p>更新主域配置信息后，再更新 peroid ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>更新 period 会更改 epoch ，还需确保其它的域会收到更新过的配置信息。</p>
</div>
</section>
<section id="id12">
<h3>更新 Ceph 配置文件<a class="headerlink" href="#id12" title="Permalink to this heading"></a></h3>
<p>更新主域所在主机上的 Ceph 配置文件，把 <code class="docutils literal notranslate"><span class="pre">rgw_zone</span></code> 配置选项和主域的名字写在例程配置段下。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">client</span><span class="o">.</span><span class="n">rgw</span><span class="o">.</span><span class="p">{</span><span class="n">instance</span><span class="o">-</span><span class="n">name</span><span class="p">}]</span>
<span class="o">...</span>
<span class="n">rgw_zone</span><span class="o">=</span><span class="p">{</span><span class="n">zone</span><span class="o">-</span><span class="n">name</span><span class="p">}</span>
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">client</span><span class="o">.</span><span class="n">rgw</span><span class="o">.</span><span class="n">rgw1</span><span class="p">]</span>
<span class="n">host</span> <span class="o">=</span> <span class="n">rgw1</span>
<span class="n">rgw</span> <span class="n">frontends</span> <span class="o">=</span> <span class="s2">&quot;civetweb port=80&quot;</span>
<span class="n">rgw_zone</span><span class="o">=</span><span class="n">us</span><span class="o">-</span><span class="n">east</span>
</pre></div>
</div>
</section>
<section id="id13">
<h3>启动网关<a class="headerlink" href="#id13" title="Permalink to this heading"></a></h3>
<p>在对象网关所在的主机上，启动 Ceph 对象网关、并启用服务：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">systemctl<span class="w"> </span>start<span class="w"> </span>ceph-radosgw@rgw.<span class="sb">`</span>hostname<span class="w"> </span>-s<span class="sb">`</span></span>
<span class="prompt1">systemctl<span class="w"> </span><span class="nb">enable</span><span class="w"> </span>ceph-radosgw@rgw.<span class="sb">`</span>hostname<span class="w"> </span>-s<span class="sb">`</span></span>
</pre></div></div></section>
</section>
<section id="secondary-zone-label">
<span id="id14"></span><h2>配置副域<a class="headerlink" href="#secondary-zone-label" title="Permalink to this heading"></a></h2>
<p>一个域组内的域们会复制所有数据，以确保各个域都有相同的数据。
创建副域需在作为副域的主机上执行下面的所有操作。</p>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>增加第二个副域（就是在一个域组内，已经有一个副域了，又建第二个副域）和
<a class="reference internal" href="#radosgw-multisite-secondary-zone-creating"><span class="std std-ref">增加副域的过程相同</span></a>。
必须用不同的域名称，不能和第一个副域一样。</p>
</div>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>必须在主域内的主机上执行元数据操作，
如用户创建。主域和副域都可以接受桶操作，
但是副域会把桶操作重定向到主域；
如果主域倒下了，桶操作会失败。</p>
</div>
<section id="id15">
<h3>拉取 realm<a class="headerlink" href="#id15" title="Permalink to this heading"></a></h3>
<p>用主域组中主域的 URL 、访问密钥和私钥可以把 realm 拉到本主机。如果要拉取的不是默认 realm ，还需用 <code class="docutils literal notranslate"><span class="pre">--rgw-realm</span></code> 或
<code class="docutils literal notranslate"><span class="pre">--realm-id</span></code> 选项指定 realm 。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>pull<span class="w"> </span>--url<span class="o">={</span>url-to-master-zone-gateway<span class="o">}</span></span>
<span class="prompt1">--access-key<span class="o">={</span>access-key<span class="o">}</span><span class="w"> </span>--secret<span class="o">={</span>secret<span class="o">}</span></span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>拉取 realm 时也会检出远端的当前 period 、
并使之成为本机的当前 period 。</p>
</div>
<p>如果这个 realm 是唯一的一个，可以让它成为默认 realm ，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>default<span class="w"> </span>--rgw-realm<span class="o">={</span>realm-name<span class="o">}</span></span>
</pre></div></div></section>
<section id="radosgw-multisite-secondary-zone-creating">
<span id="id16"></span><h3>创建副域<a class="headerlink" href="#radosgw-multisite-secondary-zone-creating" title="Permalink to this heading"></a></h3>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>域必须在此域内的 Ceph 对象网关所在节点上创建。</p>
</div>
<p>在副域内提供服务的主机上，打开命令行新建多站配置所需的副域，
需指定域组 ID 、新的域名和这个域内配置的终结点；
<strong>不要加</strong> <code class="docutils literal notranslate"><span class="pre">--master</span></code> 或 <code class="docutils literal notranslate"><span class="pre">--default</span></code> 标记。
在 Kraken 里，所有域都按多活配置运行，
也就是说，网关客户端可写入任意一个域，
这个域会把数据复制到同一域组内、除此之外的其它域上。
如果不想让副域处理写操作，创建时可以加 <code class="docutils literal notranslate"><span class="pre">--read-only</span></code> 标记，
这样主域和副域就会按主从方式配置。另外，
还需提供系统用户的 <code class="docutils literal notranslate"><span class="pre">access_key</span></code> 和 <code class="docutils literal notranslate"><span class="pre">secret_key</span></code> ，
它存储在主域组的主域内。
命令如下：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>create<span class="w"> </span>--rgw-zonegroup<span class="o">={</span>zone-group-name<span class="o">}</span><span class="w"> </span><span class="se">\</span>
<span class="w">                             </span>--rgw-zone<span class="o">={</span>zone-name<span class="o">}</span><span class="w"> </span><span class="se">\</span>
<span class="w">                             </span>--access-key<span class="o">={</span>system-key<span class="o">}</span><span class="w"> </span>--secret<span class="o">={</span>secret<span class="o">}</span><span class="w"> </span><span class="se">\</span>
<span class="w">                             </span>--endpoints<span class="o">=</span>http://<span class="o">{</span>fqdn<span class="o">}</span>:80<span class="w"> </span><span class="se">\</span>
<span class="w">                             </span><span class="o">[</span>--read-only<span class="o">]</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>create<span class="w"> </span>--rgw-zonegroup<span class="o">=</span>us<span class="w"> </span>--rgw-zone<span class="o">=</span>us-west<span class="w"> </span><span class="se">\</span>
<span class="w">                             </span>--access-key<span class="o">={</span>system-key<span class="o">}</span><span class="w"> </span>--secret<span class="o">={</span>secret<span class="o">}</span><span class="w"> </span><span class="se">\</span>
<span class="w">                             </span>--endpoints<span class="o">=</span>http://rgw2:80</span>
</pre></div></div><div class="admonition important">
<p class="admonition-title">Important</p>
<p>后续步骤假设是在新安装好的系统上实施多站配置，
上面还没有数据。
如果你已经用它存储了一些数据，<strong>不要删除</strong> <code class="docutils literal notranslate"><span class="pre">default</span></code> <strong>域及其存储池</strong>，否则数据会被删除且不可恢复。</p>
</div>
<p>如有必要，删除默认域：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>delete<span class="w"> </span>--rgw-zone<span class="o">=</span>default</span>
</pre></div></div><p>最后，如果有必要，删除 Ceph 存储集群内的默认存储池。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>default.rgw.control<span class="w"> </span>default.rgw.control<span class="w"> </span>--yes-i-really-really-mean-it</span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>default.rgw.data.root<span class="w"> </span>default.rgw.data.root<span class="w"> </span>--yes-i-really-really-mean-it</span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>default.rgw.gc<span class="w"> </span>default.rgw.gc<span class="w"> </span>--yes-i-really-really-mean-it</span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>default.rgw.log<span class="w"> </span>default.rgw.log<span class="w"> </span>--yes-i-really-really-mean-it</span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>default.rgw.users.uid<span class="w"> </span>default.rgw.users.uid<span class="w"> </span>--yes-i-really-really-mean-it</span>
</pre></div></div></section>
<section id="id17">
<h3>更新 Ceph 配置文件<a class="headerlink" href="#id17" title="Permalink to this heading"></a></h3>
<p>更新副域所在主机上的 Ceph 配置文件，把 <code class="docutils literal notranslate"><span class="pre">rgw_zone</span></code> 配置选项和副域的名字写在例程配置段下：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">client</span><span class="o">.</span><span class="n">rgw</span><span class="o">.</span><span class="p">{</span><span class="n">instance</span><span class="o">-</span><span class="n">name</span><span class="p">}]</span>
<span class="o">...</span>
<span class="n">rgw_zone</span><span class="o">=</span><span class="p">{</span><span class="n">zone</span><span class="o">-</span><span class="n">name</span><span class="p">}</span>
</pre></div>
</div>
<p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span><span class="n">client</span><span class="o">.</span><span class="n">rgw</span><span class="o">.</span><span class="n">rgw2</span><span class="p">]</span>
<span class="n">host</span> <span class="o">=</span> <span class="n">rgw2</span>
<span class="n">rgw</span> <span class="n">frontends</span> <span class="o">=</span> <span class="s2">&quot;civetweb port=80&quot;</span>
<span class="n">rgw_zone</span><span class="o">=</span><span class="n">us</span><span class="o">-</span><span class="n">west</span>
</pre></div>
</div>
</section>
<section id="id18">
<h3>更新 period<a class="headerlink" href="#id18" title="Permalink to this heading"></a></h3>
<p>更新完主域配置信息后，更新 period 。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>更新 period 会更改 epoch ，还需确保其它的域会收到更新过的配置信息。</p>
</div>
</section>
<section id="id19">
<h3>启动网关<a class="headerlink" href="#id19" title="Permalink to this heading"></a></h3>
<p>在对象网关所在的主机上，启动 Ceph 对象网关、并启用服务：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">systemctl<span class="w"> </span>start<span class="w"> </span>ceph-radosgw@rgw.<span class="sb">`</span>hostname<span class="w"> </span>-s<span class="sb">`</span></span>
<span class="prompt1">systemctl<span class="w"> </span><span class="nb">enable</span><span class="w"> </span>ceph-radosgw@rgw.<span class="sb">`</span>hostname<span class="w"> </span>-s<span class="sb">`</span></span>
</pre></div></div><p>如果使用 <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> 命令部署集群，则无法使用 <code class="docutils literal notranslate"><span class="pre">systemctl</span></code> 启动网关，
因为不存在 <code class="docutils literal notranslate"><span class="pre">systemctl</span></code> 可以运行的服务。这是由于 <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> 部署的
Ceph 集群是容器化的。如果用了 <code class="docutils literal notranslate"><span class="pre">cephadm</span></code> 命令并拥有一个容器化集群，
可以运行以下命令来启动网关：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>orch<span class="w"> </span>apply<span class="w"> </span>rgw<span class="w"> </span>&lt;name&gt;<span class="w"> </span>--realm<span class="o">=</span>&lt;realm&gt;<span class="w"> </span>--zone<span class="o">=</span>&lt;zone&gt;<span class="w"> </span>--placement<span class="w"> </span>--port</span>
</pre></div></div></section>
<section id="id20">
<h3>检查同步状态<a class="headerlink" href="#id20" title="Permalink to this heading"></a></h3>
<p>副域起来并正常运行后，检查一下同步状态。
同步过程就是把主域中创建的用户和桶都复制到副域。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>sync<span class="w"> </span>status</span>
</pre></div></div><p>此命令的输出会显示同步操作的状态，例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">realm</span> <span class="n">f3239bc5</span><span class="o">-</span><span class="n">e1a8</span><span class="o">-</span><span class="mi">4206</span><span class="o">-</span><span class="n">a81d</span><span class="o">-</span><span class="n">e1576480804d</span> <span class="p">(</span><span class="n">earth</span><span class="p">)</span>
    <span class="n">zonegroup</span> <span class="n">c50dbb7e</span><span class="o">-</span><span class="n">d9ce</span><span class="o">-</span><span class="mi">47</span><span class="n">cc</span><span class="o">-</span><span class="n">a8bb</span><span class="o">-</span><span class="mi">97</span><span class="n">d9b399d388</span> <span class="p">(</span><span class="n">us</span><span class="p">)</span>
         <span class="n">zone</span> <span class="mi">4</span><span class="n">c453b70</span><span class="o">-</span><span class="mi">4</span><span class="n">a16</span><span class="o">-</span><span class="mi">4</span><span class="n">ce8</span><span class="o">-</span><span class="mi">8185</span><span class="o">-</span><span class="mi">1893</span><span class="n">b05d346e</span> <span class="p">(</span><span class="n">us</span><span class="o">-</span><span class="n">west</span><span class="p">)</span>
<span class="n">metadata</span> <span class="n">sync</span> <span class="n">syncing</span>
              <span class="n">full</span> <span class="n">sync</span><span class="p">:</span> <span class="mi">0</span><span class="o">/</span><span class="mi">64</span> <span class="n">shards</span>
              <span class="n">metadata</span> <span class="ow">is</span> <span class="n">caught</span> <span class="n">up</span> <span class="k">with</span> <span class="n">master</span>
              <span class="n">incremental</span> <span class="n">sync</span><span class="p">:</span> <span class="mi">64</span><span class="o">/</span><span class="mi">64</span> <span class="n">shards</span>
    <span class="n">data</span> <span class="n">sync</span> <span class="n">source</span><span class="p">:</span> <span class="mi">1</span><span class="n">ee9da3e</span><span class="o">-</span><span class="mi">114</span><span class="n">d</span><span class="o">-</span><span class="mi">4</span><span class="n">ae3</span><span class="o">-</span><span class="n">a8a4</span><span class="o">-</span><span class="mf">056e8</span><span class="n">a17f532</span> <span class="p">(</span><span class="n">us</span><span class="o">-</span><span class="n">east</span><span class="p">)</span>
                      <span class="n">syncing</span>
                      <span class="n">full</span> <span class="n">sync</span><span class="p">:</span> <span class="mi">0</span><span class="o">/</span><span class="mi">128</span> <span class="n">shards</span>
                      <span class="n">incremental</span> <span class="n">sync</span><span class="p">:</span> <span class="mi">128</span><span class="o">/</span><span class="mi">128</span> <span class="n">shards</span>
                      <span class="n">data</span> <span class="ow">is</span> <span class="n">caught</span> <span class="n">up</span> <span class="k">with</span> <span class="n">source</span>
</pre></div>
</div>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>副域可以接受桶操作，
然而它们会把桶操作重定向到主域，
然后再与主域同步，获取桶操作的结果。
如果主域倒下了，副域上的桶操作会失败，
但是对象操作仍会成功。</p>
</div>
</section>
<section id="id21">
<h3>对象的校验<a class="headerlink" href="#id21" title="Permalink to this heading"></a></h3>
<p>默认情况下，一个对象成功同步后不会再次校验。
要启用此功能，你可以把 <code class="xref std std-confval docutils literal notranslate"><span class="pre">rgw_sync_obj_etag_verify</span></code> 设置为 <code class="docutils literal notranslate"><span class="pre">true</span></code> 。
启用这个可选功能后，对象还会继续同步，
在同步源和目的地都会额外计算对象的 MD5 校验和并核对。
在经过 HTTP 远程传输后，包括多站同步，这样做可以保证对象的整体性。
这个选项会降低 RGW 的性能，因为需要的计算量更大。</p>
</section>
</section>
<section id="id22">
<h2>维护<a class="headerlink" href="#id22" title="Permalink to this heading"></a></h2>
<section id="id23">
<h3>检查同步状态<a class="headerlink" href="#id23" title="Permalink to this heading"></a></h3>
<p>某个域的复制状态可以这样查询：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><style type="text/css">
span.prompt2:before {
  content: "$ ";
}
</style><span class="prompt2">radosgw-admin<span class="w"> </span>sync<span class="w"> </span>status</span>
</pre></div></div><div class="highlight-default notranslate"><div class="highlight"><pre><span></span>    <span class="n">realm</span> <span class="n">b3bc1c37</span><span class="o">-</span><span class="mi">9</span><span class="n">c44</span><span class="o">-</span><span class="mi">4</span><span class="n">b89</span><span class="o">-</span><span class="n">a03b</span><span class="o">-</span><span class="mi">04</span><span class="n">c269bea5da</span> <span class="p">(</span><span class="n">earth</span><span class="p">)</span>
<span class="n">zonegroup</span> <span class="n">f54f9b22</span><span class="o">-</span><span class="n">b4b6</span><span class="o">-</span><span class="mi">4</span><span class="n">a0e</span><span class="o">-</span><span class="mi">9211</span><span class="o">-</span><span class="n">fa6ac1693f49</span> <span class="p">(</span><span class="n">us</span><span class="p">)</span>
     <span class="n">zone</span> <span class="n">adce11c9</span><span class="o">-</span><span class="n">b8ed</span><span class="o">-</span><span class="mi">4</span><span class="n">a90</span><span class="o">-</span><span class="mi">8</span><span class="n">bc5</span><span class="o">-</span><span class="mi">3</span><span class="n">fc029ff0816</span> <span class="p">(</span><span class="n">us</span><span class="o">-</span><span class="mi">2</span><span class="p">)</span>
    <span class="n">metadata</span> <span class="n">sync</span> <span class="n">syncing</span>
          <span class="n">full</span> <span class="n">sync</span><span class="p">:</span> <span class="mi">0</span><span class="o">/</span><span class="mi">64</span> <span class="n">shards</span>
          <span class="n">incremental</span> <span class="n">sync</span><span class="p">:</span> <span class="mi">64</span><span class="o">/</span><span class="mi">64</span> <span class="n">shards</span>
          <span class="n">metadata</span> <span class="ow">is</span> <span class="n">behind</span> <span class="n">on</span> <span class="mi">1</span> <span class="n">shards</span>
          <span class="n">oldest</span> <span class="n">incremental</span> <span class="n">change</span> <span class="ow">not</span> <span class="n">applied</span><span class="p">:</span> <span class="mi">2017</span><span class="o">-</span><span class="mi">03</span><span class="o">-</span><span class="mi">22</span> <span class="mi">10</span><span class="p">:</span><span class="mi">20</span><span class="p">:</span><span class="mf">00.0.881361</span><span class="n">s</span>
<span class="n">data</span> <span class="n">sync</span> <span class="n">source</span><span class="p">:</span> <span class="mi">341</span><span class="n">c2d81</span><span class="o">-</span><span class="mi">4574</span><span class="o">-</span><span class="mi">4</span><span class="n">d08</span><span class="o">-</span><span class="n">ab0f</span><span class="o">-</span><span class="mi">5</span><span class="n">a2a7b168028</span> <span class="p">(</span><span class="n">us</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span>
                  <span class="n">syncing</span>
                  <span class="n">full</span> <span class="n">sync</span><span class="p">:</span> <span class="mi">0</span><span class="o">/</span><span class="mi">128</span> <span class="n">shards</span>
                  <span class="n">incremental</span> <span class="n">sync</span><span class="p">:</span> <span class="mi">128</span><span class="o">/</span><span class="mi">128</span> <span class="n">shards</span>
                  <span class="n">data</span> <span class="ow">is</span> <span class="n">caught</span> <span class="n">up</span> <span class="k">with</span> <span class="n">source</span>
          <span class="n">source</span><span class="p">:</span> <span class="mi">3</span><span class="n">b5d1a3f</span><span class="o">-</span><span class="mi">3</span><span class="n">f27</span><span class="o">-</span><span class="mf">4e4</span><span class="n">a</span><span class="o">-</span><span class="mi">8</span><span class="n">f34</span><span class="o">-</span><span class="mi">6072</span><span class="n">d4bb1275</span> <span class="p">(</span><span class="n">us</span><span class="o">-</span><span class="mi">3</span><span class="p">)</span>
                  <span class="n">syncing</span>
                  <span class="n">full</span> <span class="n">sync</span><span class="p">:</span> <span class="mi">0</span><span class="o">/</span><span class="mi">128</span> <span class="n">shards</span>
                  <span class="n">incremental</span> <span class="n">sync</span><span class="p">:</span> <span class="mi">128</span><span class="o">/</span><span class="mi">128</span> <span class="n">shards</span>
                  <span class="n">data</span> <span class="ow">is</span> <span class="n">caught</span> <span class="n">up</span> <span class="k">with</span> <span class="n">source</span>
</pre></div>
</div>
<p>输出结果不同由同步状态决定。同步时，分片有两种类型：</p>
<ul class="simple">
<li><p><strong>Behind shards （落伍分片）</strong> 是那些需要完整的数据同步、
或者需要增量数据同步的分片们，因为它们不是最新版本。</p></li>
<li><p><strong>Recovery shards （恢复分片）</strong> 是那些在同步时遇到错误、
并被标记为需要重试的分片们。这种错误大多是小问题，像获取桶的锁。
一般它都能自己解决。</p></li>
</ul>
</section>
<section id="id24">
<h3>检查日志<a class="headerlink" href="#id24" title="Permalink to this heading"></a></h3>
<p>仅限于多站配置而言，你可以检查元数据日志（ <code class="docutils literal notranslate"><span class="pre">mdlog</span></code> ）、
桶索引日志（ <code class="docutils literal notranslate"><span class="pre">bilog</span></code> ）、和数据日志（ <code class="docutils literal notranslate"><span class="pre">mdlog</span></code> ）。
你可以罗列出它们、还能清理它们。大多数情况下都不需要清理这些日志，
因为 <code class="xref std std-confval docutils literal notranslate"><span class="pre">rgw_sync_log_trim_interval</span></code> 默认设置成了 20 分钟。
如果把 <code class="xref std std-confval docutils literal notranslate"><span class="pre">rgw_sync_log_trim_interval</span></code> 手动设置成 0 ，就需要清理日志。</p>
</section>
<section id="id25">
<h3>更改元数据主域<a class="headerlink" href="#id25" title="Permalink to this heading"></a></h3>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>要把一个域提升成主的，从而更改元数据主域时要格外小心。
如果一个域还没与当前的主域同步完元数据，那么它晋级成为主域后，
不能为尚未同步完的条目提供服务，而且这些变更将丢失。
有鉴于此，我们建议先等这个域的元数据同步状态
<code class="docutils literal notranslate"><span class="pre">radosgw-admin</span> <span class="pre">sync</span> <span class="pre">status</span></code> 完成，然后再把它晋级为主域。</p>
</div>
<p>类似地，如果当前的主域正在处理元数据变更，
此时另一个域却被晋级成了主域，那么这些变更很可能会丢失。
为避免出现此类情况，建议关闭先前主域内的所有 <code class="docutils literal notranslate"><span class="pre">radosgw</span></code> 例程；
等晋级完另一个域之后，可以用 <code class="docutils literal notranslate"><span class="pre">radosgw-admin</span> <span class="pre">period</span> <span class="pre">pull</span></code>
拉取先前主域的新 period ，然后再启动先前停掉的网关。</p>
<p>要想把一个域（例如 <code class="docutils literal notranslate"><span class="pre">us</span></code> 域组内的 <code class="docutils literal notranslate"><span class="pre">us-2</span></code> 域）晋级为元数据主域，
在这个域上做如下操作：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt2">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>modify<span class="w"> </span>--rgw-zone<span class="o">=</span>us-2<span class="w"> </span>--master</span>
<span class="prompt2">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>modify<span class="w"> </span>--rgw-zonegroup<span class="o">=</span>us<span class="w"> </span>--master</span>
<span class="prompt2">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div><p>这样就会生成一个新 period ，而且 <code class="docutils literal notranslate"><span class="pre">us-2</span></code> 域内的 radosgw 例程会把这个 period 发给其它域。</p>
</section>
</section>
<section id="id26">
<h2>故障切换和灾难恢复<a class="headerlink" href="#id26" title="Permalink to this heading"></a></h2>
<section id="id27">
<h3>故障切换到副域的配置<a class="headerlink" href="#id27" title="Permalink to this heading"></a></h3>
<p>如果主域失败，则切换到副域以作灾难恢复，按照下列步骤：</p>
<ol class="arabic">
<li><p>让副域成为默认的主域，例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>modify<span class="w"> </span>--rgw-zone<span class="o">={</span>zone-name<span class="o">}</span><span class="w"> </span>--master<span class="w"> </span>--default</span>
</pre></div></div><p>默认情况下， Ceph 对象网关运行在多活模式下。
如果集群被配置成了主从模式，
那么副域是个只读域，
需要去除 <code class="docutils literal notranslate"><span class="pre">--read-only</span></code> 状态，
以允许这个域处理写操作。例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>modify<span class="w"> </span>--rgw-zone<span class="o">={</span>zone-name<span class="o">}</span><span class="w"> </span>--master<span class="w"> </span>--default<span class="w"> </span><span class="se">\</span>
<span class="w">                             </span>--read-only<span class="o">=</span><span class="nb">false</span></span>
</pre></div></div></li>
<li><p>更新 period 以使变更生效。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></li>
<li><p>最后，重启 Ceph 对象网关。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">systemctl<span class="w"> </span>restart<span class="w"> </span>ceph-radosgw@rgw.<span class="sb">`</span>hostname<span class="w"> </span>-s<span class="sb">`</span></span>
</pre></div></div></li>
</ol>
</section>
<section id="id28">
<h3>从故障切换回退<a class="headerlink" href="#id28" title="Permalink to this heading"></a></h3>
<p>如果前任主域恢复了，可以回退故障切换操作，按照下列步骤：</p>
<ol class="arabic">
<li><p>在已恢复的域里，从当前的主域拉取最新的 realm 配置：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>pull<span class="w"> </span>--url<span class="o">={</span>url-to-master-zone-gateway<span class="o">}</span><span class="w"> </span><span class="se">\</span>
<span class="w">                            </span>--access-key<span class="o">={</span>access-key<span class="o">}</span><span class="w"> </span>--secret<span class="o">={</span>secret<span class="o">}</span></span>
</pre></div></div></li>
<li><p>让恢复的域成为默认的主域：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>modify<span class="w"> </span>--rgw-zone<span class="o">={</span>zone-name<span class="o">}</span><span class="w"> </span>--master<span class="w"> </span>--default</span>
</pre></div></div></li>
<li><p>更新 period 以使变更生效：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></li>
<li><p>然后，在恢复好的域里重启 Ceph 对象网关。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">systemctl<span class="w"> </span>restart<span class="w"> </span>ceph-radosgw@rgw.<span class="sb">`</span>hostname<span class="w"> </span>-s<span class="sb">`</span></span>
</pre></div></div></li>
<li><p>如果副域还要恢复为只读配置，
更新一下副域。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>modify<span class="w"> </span>--rgw-zone<span class="o">={</span>zone-name<span class="o">}</span><span class="w"> </span>--read-only</span>
</pre></div></div></li>
<li><p>更新 period 以使变更生效。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></li>
<li><p>最后，重启次域里的 Ceph 对象网关。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">systemctl<span class="w"> </span>restart<span class="w"> </span>ceph-radosgw@rgw.<span class="sb">`</span>hostname<span class="w"> </span>-s<span class="sb">`</span></span>
</pre></div></div></li>
</ol>
</section>
</section>
<section id="rgw-multisite-migrate-from-single-site">
<span id="id29"></span><h2>从单站迁移到多站配置<a class="headerlink" href="#rgw-multisite-migrate-from-single-site" title="Permalink to this heading"></a></h2>
<p>要想从只有一个 <code class="docutils literal notranslate"><span class="pre">default</span></code> 域组和域的单站系统迁移到多站系统，
可以按如下步骤实施：</p>
<ol class="arabic">
<li><p>创建一个 realm ，把下面命令中的 <code class="docutils literal notranslate"><span class="pre">&lt;name&gt;</span></code> 换成 realm 名字。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>create<span class="w"> </span>--rgw-realm<span class="o">=</span>&lt;name&gt;<span class="w"> </span>--default</span>
</pre></div></div></li>
<li><p>重命名默认域和域组，把 <code class="docutils literal notranslate"><span class="pre">&lt;name&gt;</span></code> 替换成域组和域名字。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>rename<span class="w"> </span>--rgw-zonegroup<span class="w"> </span>default<span class="w"> </span>--zonegroup-new-name<span class="o">=</span>&lt;name&gt;</span>
<span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>rename<span class="w"> </span>--rgw-zone<span class="w"> </span>default<span class="w"> </span>--zone-new-name<span class="w"> </span>us-east-1<span class="w"> </span>--rgw-zonegroup<span class="o">=</span>&lt;name&gt;</span>
</pre></div></div></li>
<li><p>重命名默认域组的 <code class="docutils literal notranslate"><span class="pre">api_name</span></code> ，把 <code class="docutils literal notranslate"><span class="pre">&lt;name&gt;</span></code> 换成域组名：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>modify<span class="w"> </span>--api-name<span class="o">=</span>&lt;name&gt;<span class="w"> </span>--rgw-zonegroup<span class="o">=</span>&lt;name&gt;</span>
</pre></div></div></li>
<li><p>配置主域组。把 <code class="docutils literal notranslate"><span class="pre">&lt;name&gt;</span></code> 替换成 realm 或域组的名字；
<code class="docutils literal notranslate"><span class="pre">&lt;fqdn&gt;</span></code> 替换成域组内配置的全资域名。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>modify<span class="w"> </span>--rgw-realm<span class="o">=</span>&lt;name&gt;<span class="w"> </span>--rgw-zonegroup<span class="o">=</span>&lt;name&gt;<span class="w"> </span>--endpoints<span class="w"> </span>http://&lt;fqdn&gt;:80<span class="w"> </span>--master<span class="w"> </span>--default</span>
</pre></div></div></li>
<li><p>配置主域。把 <code class="docutils literal notranslate"><span class="pre">&lt;name&gt;</span></code> 替换成
realm 、域组或域的名字；
<code class="docutils literal notranslate"><span class="pre">&lt;fqdn&gt;</span></code> 替换成域组内配置的全资域名。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>modify<span class="w"> </span>--rgw-realm<span class="o">=</span>&lt;name&gt;<span class="w"> </span>--rgw-zonegroup<span class="o">=</span>&lt;name&gt;<span class="w"> </span><span class="se">\</span>
<span class="w">                          </span>--rgw-zone<span class="o">=</span>&lt;name&gt;<span class="w"> </span>--endpoints<span class="w"> </span>http://&lt;fqdn&gt;:80<span class="w"> </span><span class="se">\</span>
<span class="w">                          </span>--access-key<span class="o">=</span>&lt;access-key&gt;<span class="w"> </span>--secret<span class="o">=</span>&lt;secret-key&gt;<span class="w"> </span><span class="se">\</span>
<span class="w">                          </span>--master<span class="w"> </span>--default</span>
</pre></div></div></li>
<li><p>创建一个系统用户。把 <code class="docutils literal notranslate"><span class="pre">&lt;user-id&gt;</span></code> 替换成用户名；
<code class="docutils literal notranslate"><span class="pre">&lt;display-name&gt;</span></code> 替换成显示名称，
它可以包含空格。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>user<span class="w"> </span>create<span class="w"> </span>--uid<span class="o">=</span>&lt;user-id&gt;<span class="w"> </span><span class="se">\</span>
--display-name<span class="o">=</span><span class="s2">&quot;&lt;display-name&gt;&quot;</span><span class="w"> </span><span class="se">\</span>
--access-key<span class="o">=</span>&lt;access-key&gt;<span class="w"> </span><span class="se">\</span>
--secret<span class="o">=</span>&lt;secret-key&gt;<span class="w"> </span>--system</span>
</pre></div></div></li>
<li><p>提交更新过的配置：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></li>
<li><p>重启 Ceph 对象网关：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">systemctl<span class="w"> </span>restart<span class="w"> </span>ceph-radosgw@rgw.<span class="sb">`</span>hostname<span class="w"> </span>-s<span class="sb">`</span></span>
</pre></div></div></li>
</ol>
<p>完成这一步以后，可以继续<a class="reference external" href="#configure-secondary-zones">配置一个副域</a> ，
并在主域组中创建第二个域。</p>
</section>
<section id="id31">
<h2>多站配置参考<a class="headerlink" href="#id31" title="Permalink to this heading"></a></h2>
<p>以下是附上细节信息，以及与 realm 、 period 、 zonegroup （域组）、 zone （域）
相关的命令行用法。</p>
<p>要看每个可用配置选项的详细用法，请看 <code class="docutils literal notranslate"><span class="pre">src/common/options/rgw.yaml.in</span></code> 文件。</p>
<p>另外，可以看看 <a class="reference internal" href="../../mgr/dashboard/#mgr-dashboard"><span class="std std-ref">Ceph 仪表盘</span></a> 配置页面（在 <cite>Cluster</cite> 内），
在这里你可以方便地查看和配置所有选项。
在这个页面上，把水平设置为 <code class="docutils literal notranslate"><span class="pre">advanced</span></code> 然后搜索 RGW ，
能看到所有基本和高级的配置选项。</p>
<section id="realms">
<span id="rgw-realms"></span><h3>Realms<a class="headerlink" href="#realms" title="Permalink to this heading"></a></h3>
<p>一个 realm 就是一个全局唯一的命名空间，它由一个或多个域组组成。
域组又包含一或多个域，域包含桶、桶内是对象。</p>
<p>realm 概念可以让 Ceph 对象网关在同一套硬件上配置多个命名空间。</p>
<p>realm 暗含了 period 概念，
每个 period 表示了域组和域在当时的配置状态。
每次更改域组或域后都需要更新 period 并提交它。</p>
<p>考虑到与 Infernalis 以及更早版本的向后兼容问题，
默认情况下， Ceph 对象网关不会创建 realm 。
然而，我们建议您最好在新集群上创建 realm 。</p>
<section id="id32">
<h4>创建 realm<a class="headerlink" href="#id32" title="Permalink to this heading"></a></h4>
<p>创建 realm 可用 <code class="docutils literal notranslate"><span class="pre">realm</span> <span class="pre">create</span></code> 命令，并加上 realm 名字。
如果要创建默认的 realm ，需指定 <code class="docutils literal notranslate"><span class="pre">--default</span></code> 参数。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>create<span class="w"> </span>--rgw-realm<span class="o">={</span>realm-name<span class="o">}</span><span class="w"> </span><span class="o">[</span>--default<span class="o">]</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>create<span class="w"> </span>--rgw-realm<span class="o">=</span>movies<span class="w"> </span>--default</span>
</pre></div></div><p>指定 <code class="docutils literal notranslate"><span class="pre">--default</span></code> 以后，每次调用 <code class="docutils literal notranslate"><span class="pre">radosgw-admin</span></code> 都会默认指向这个 realm ，
除非另外指定了 <code class="docutils literal notranslate"><span class="pre">--rgw-realm</span></code> 和 realm 名字。</p>
</section>
<section id="id33">
<h4>让 realm 成为默认<a class="headerlink" href="#id33" title="Permalink to this heading"></a></h4>
<p>一堆 realm 里应该有一个默认的，而且只能有一个默认的。如果只有一个 realm ，而且创建时没把它设置为默认，也可以稍后设置成默认的。或者，要把某个 realm 改成默认的，用命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>default<span class="w"> </span>--rgw-realm<span class="o">=</span>movies</span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>如果要操作的 realm 是默认的，命令会认为已经加了
<code class="docutils literal notranslate"><span class="pre">--rgw-realm=&lt;realm-name&gt;</span></code> 参数。</p>
</div>
</section>
<section id="id34">
<h4>删除 realm<a class="headerlink" href="#id34" title="Permalink to this heading"></a></h4>
<p>删除 realm 可用 <code class="docutils literal notranslate"><span class="pre">realm</span> <span class="pre">rm</span></code> 并加上其名字。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>rm<span class="w"> </span>--rgw-realm<span class="o">={</span>realm-name<span class="o">}</span></span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>rm<span class="w"> </span>--rgw-realm<span class="o">=</span>movies</span>
</pre></div></div></section>
<section id="id35">
<h4>查看 realm<a class="headerlink" href="#id35" title="Permalink to this heading"></a></h4>
<p>查看 realm 可用 <code class="docutils literal notranslate"><span class="pre">realm</span> <span class="pre">get</span></code> 并加上其名字。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>get<span class="w"> </span>--rgw-realm<span class="o">=</span>&lt;name&gt;</span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>get<span class="w"> </span>--rgw-realm<span class="o">=</span>movies<span class="w"> </span><span class="o">[</span>&gt;<span class="w"> </span>filename.json<span class="o">]</span></span>
</pre></div></div><div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
    <span class="s2">&quot;id&quot;</span><span class="p">:</span> <span class="s2">&quot;0a68d52e-a19c-4e8e-b012-a8f831cb3ebc&quot;</span><span class="p">,</span>
    <span class="s2">&quot;name&quot;</span><span class="p">:</span> <span class="s2">&quot;movies&quot;</span><span class="p">,</span>
    <span class="s2">&quot;current_period&quot;</span><span class="p">:</span> <span class="s2">&quot;b0c5bbef-4337-4edd-8184-5aeab2ec413b&quot;</span><span class="p">,</span>
    <span class="s2">&quot;epoch&quot;</span><span class="p">:</span> <span class="mi">1</span>
<span class="p">}</span>
</pre></div>
</div>
</section>
<section id="id36">
<h4>配置 realm<a class="headerlink" href="#id36" title="Permalink to this heading"></a></h4>
<p>配置 realm 用 <code class="docutils literal notranslate"><span class="pre">realm</span> <span class="pre">set</span></code> ，还要指定其名字、和 <code class="docutils literal notranslate"><span class="pre">--infile=</span></code> 并输入文件名。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span><span class="nb">set</span><span class="w"> </span>--rgw-realm<span class="o">=</span>&lt;name&gt;<span class="w"> </span>--infile<span class="o">=</span>&lt;infilename&gt;</span>
</pre></div></div><p>例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span><span class="nb">set</span><span class="w"> </span>--rgw-realm<span class="o">=</span>movies<span class="w"> </span>--infile<span class="o">=</span>filename.json</span>
</pre></div></div></section>
<section id="id37">
<h4>罗列 realm<a class="headerlink" href="#id37" title="Permalink to this heading"></a></h4>
<p>罗列 realm 可用 <code class="docutils literal notranslate"><span class="pre">realm</span> <span class="pre">list</span></code> ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>list</span>
</pre></div></div></section>
<section id="realm-period">
<h4>罗列 realm 的 period<a class="headerlink" href="#realm-period" title="Permalink to this heading"></a></h4>
<p>罗列 realm 的 period 可用 <code class="docutils literal notranslate"><span class="pre">realm</span> <span class="pre">list-periods</span></code> 。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>list-periods</span>
</pre></div></div></section>
<section id="id38">
<h4>拉取 realm 配置<a class="headerlink" href="#id38" title="Permalink to this heading"></a></h4>
<p>要把 realm 配置从包含主域组和主域的节点拉取到包含副域组或副域的节点，
在接收 realm 配置的节点上执行 <code class="docutils literal notranslate"><span class="pre">realm</span> <span class="pre">pull</span></code> ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>pull<span class="w"> </span>--url<span class="o">={</span>url-to-master-zone-gateway<span class="o">}</span><span class="w"> </span>--access-key<span class="o">={</span>access-key<span class="o">}</span><span class="w"> </span>--secret<span class="o">={</span>secret<span class="o">}</span></span>
</pre></div></div></section>
<section id="id39">
<h4>重命名 realm<a class="headerlink" href="#id39" title="Permalink to this heading"></a></h4>
<p>realm 并非 period 的一部分，所以，对 realm 的重命名只在本地生效，
不会随 <code class="docutils literal notranslate"><span class="pre">realm</span> <span class="pre">pull</span></code> 拉过去。重命名一个包含多个域的 realm 时，
需要在各个域上分别执行 <code class="docutils literal notranslate"><span class="pre">rename</span></code> 命令。</p>
<p>要重命名一个 realm ，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>realm<span class="w"> </span>rename<span class="w"> </span>--rgw-realm<span class="o">=</span>&lt;current-name&gt;<span class="w"> </span>--realm-new-name<span class="o">=</span>&lt;new-realm-name&gt;</span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p><strong>不要</strong>用 <code class="docutils literal notranslate"><span class="pre">realm</span> <span class="pre">set</span></code> 更改 <code class="docutils literal notranslate"><span class="pre">name</span></code> 参数，这样只能更改内部名字，
指定 <code class="docutils literal notranslate"><span class="pre">--rgw-realm</span></code> 时还是只能用老的 realm 名。</p>
</div>
</section>
</section>
<section id="id40">
<h3>域组<a class="headerlink" href="#id40" title="Permalink to this heading"></a></h3>
<p>域组出现后， Ceph 对象网关就可以支持多站部署和全局命名空间。
域组在 Infernalis 版之前叫作 region 。</p>
<p>域组定义了各个域内一或多个 Ceph 对象网关例程的地理位置。</p>
<p>域组的配置与典型的配置过程有所不同，因为不是所有配置都在 Ceph 配置文件里。</p>
<p>你可以罗列域组、查看或更改域组配置。</p>
<section id="id41">
<h4>创建域组<a class="headerlink" href="#id41" title="Permalink to this heading"></a></h4>
<p>创建域组时需指定：域组名、默认 realm 里新创建的各个域
（或者用 <code class="docutils literal notranslate"><span class="pre">--rgw-realm=&lt;realm-name&gt;</span></code> 选项指定了别的 realm ）。</p>
<p>加 <code class="docutils literal notranslate"><span class="pre">--default</span></code> 参数则创建为默认域组；
加 <code class="docutils literal notranslate"><span class="pre">--master</span></code> 参数则创建为主域组。例如：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>create<span class="w"> </span>--rgw-zonegroup<span class="o">=</span>&lt;name&gt;<span class="w"> </span><span class="o">[</span>--rgw-realm<span class="o">=</span>&lt;name&gt;<span class="o">][</span>--master<span class="o">]</span><span class="w"> </span><span class="o">[</span>--default<span class="o">]</span></span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>已存在域组的配置可用 <code class="docutils literal notranslate"><span class="pre">zonegroup</span> <span class="pre">modify</span> <span class="pre">--rgw-zonegroup=&lt;zonegroup-name&gt;</span></code> 更改。</p>
</div>
</section>
<section id="id42">
<h4>让域组成为默认<a class="headerlink" href="#id42" title="Permalink to this heading"></a></h4>
<p>一堆域组里应该有一个默认的，且只能有一个默认域组。
如果只有一个域组，且创建时没指定为默认，可让它成为默认域组。用命令：</p>
<ol class="arabic">
<li><p>把一个域组指定成默认域组：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>default<span class="w"> </span>--rgw-zonegroup<span class="o">=</span>comedy</span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>有默认域组时，命令会认为那个域组的名字就是
<code class="docutils literal notranslate"><span class="pre">--rgw-zonegroup=&lt;zonegroup-name&gt;</span></code> 选项的参数。（本例中，
为了保持一致性和易读性，保留了 <code class="docutils literal notranslate"><span class="pre">&lt;zonegroup-name&gt;</span></code> 。）</p>
</div>
</li>
<li><p>更新 period ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></li>
</ol>
</section>
<section id="id43">
<h4>把域加进域组<a class="headerlink" href="#id43" title="Permalink to this heading"></a></h4>
<p>这一步解释如何把域加入域组。</p>
<ol class="arabic">
<li><p>执行下列命令，把域加进域组：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>add<span class="w"> </span>--rgw-zonegroup<span class="o">=</span>&lt;name&gt;<span class="w"> </span>--rgw-zone<span class="o">=</span>&lt;name&gt;</span>
</pre></div></div></li>
<li><p>更新 period ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></li>
</ol>
</section>
<section id="id44">
<h4>删除域组中的域<a class="headerlink" href="#id44" title="Permalink to this heading"></a></h4>
<ol class="arabic">
<li><p>从域组删除域可以用下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>remove<span class="w"> </span>--rgw-zonegroup<span class="o">=</span>&lt;name&gt;<span class="w"> </span>--rgw-zone<span class="o">=</span>&lt;name&gt;</span>
</pre></div></div></li>
<li><p>更新 period ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></li>
</ol>
</section>
<section id="id45">
<h4>重命名域组<a class="headerlink" href="#id45" title="Permalink to this heading"></a></h4>
<ol class="arabic">
<li><p>重命名一个域组可以用：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>rename<span class="w"> </span>--rgw-zonegroup<span class="o">=</span>&lt;name&gt;<span class="w"> </span>--zonegroup-new-name<span class="o">=</span>&lt;name&gt;</span>
</pre></div></div></li>
<li><p>更新 period ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></li>
</ol>
</section>
<section id="id46">
<h4>删除域组<a class="headerlink" href="#id46" title="Permalink to this heading"></a></h4>
<ol class="arabic">
<li><p>要删除域组，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>delete<span class="w"> </span>--rgw-zonegroup<span class="o">=</span>&lt;name&gt;</span>
</pre></div></div></li>
<li><p>更新 period ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></li>
</ol>
</section>
<section id="id47">
<h4>罗列域组<a class="headerlink" href="#id47" title="Permalink to this heading"></a></h4>
<p>一个 Ceph 集群可以有很多域组，用以下命令可以罗列出来：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>list</span>
</pre></div></div><p><code class="docutils literal notranslate"><span class="pre">radosgw-admin</span></code> 会返回 JSON 格式的域组列表：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
    <span class="s2">&quot;default_info&quot;</span><span class="p">:</span> <span class="s2">&quot;90b28698-e7c3-462c-a42d-4aa780d24eda&quot;</span><span class="p">,</span>
    <span class="s2">&quot;zonegroups&quot;</span><span class="p">:</span> <span class="p">[</span>
        <span class="s2">&quot;us&quot;</span>
    <span class="p">]</span>
<span class="p">}</span>
</pre></div>
</div>
</section>
<section id="id48">
<h4>查看域组映射图<a class="headerlink" href="#id48" title="Permalink to this heading"></a></h4>
<p>要查看各域组的详情，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup-map<span class="w"> </span>get</span>
</pre></div></div><div class="admonition note">
<p class="admonition-title">Note</p>
<p>如果你遇到了 <code class="docutils literal notranslate"><span class="pre">failed</span> <span class="pre">to</span> <span class="pre">read</span> <span class="pre">zonegroup</span> <span class="pre">map</span></code> 错误，首先试一下以 root 身份运行 <code class="docutils literal notranslate"><span class="pre">radosgw-admin</span> <span class="pre">zonegroup-map</span> <span class="pre">update</span></code> 。</p>
</div>
</section>
<section id="id49">
<h4>查看域组<a class="headerlink" href="#id49" title="Permalink to this heading"></a></h4>
<p>查看域组配置可以用命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>get<span class="w"> </span><span class="o">[</span>--rgw-zonegroup<span class="o">=</span>&lt;zonegroup&gt;<span class="o">]</span></span>
</pre></div></div><p>域组配置的长相如下：</p>
<div class="highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="w">    </span><span class="nt">&quot;id&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;90b28698-e7c3-462c-a42d-4aa780d24eda&quot;</span><span class="p">,</span>
<span class="w">    </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;us&quot;</span><span class="p">,</span>
<span class="w">    </span><span class="nt">&quot;api_name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;us&quot;</span><span class="p">,</span>
<span class="w">    </span><span class="nt">&quot;is_master&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;true&quot;</span><span class="p">,</span>
<span class="w">    </span><span class="nt">&quot;endpoints&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span>
<span class="w">        </span><span class="s2">&quot;http:\/\/rgw1:80&quot;</span>
<span class="w">    </span><span class="p">],</span>
<span class="w">    </span><span class="nt">&quot;hostnames&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span>
<span class="w">    </span><span class="nt">&quot;hostnames_s3website&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span>
<span class="w">    </span><span class="nt">&quot;master_zone&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;9248cab2-afe7-43d8-a661-a40bf316665e&quot;</span><span class="p">,</span>
<span class="w">    </span><span class="nt">&quot;zones&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span>
<span class="w">        </span><span class="p">{</span>
<span class="w">            </span><span class="nt">&quot;id&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;9248cab2-afe7-43d8-a661-a40bf316665e&quot;</span><span class="p">,</span>
<span class="w">            </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;us-east&quot;</span><span class="p">,</span>
<span class="w">            </span><span class="nt">&quot;endpoints&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span>
<span class="w">                </span><span class="s2">&quot;http:\/\/rgw1&quot;</span>
<span class="w">            </span><span class="p">],</span>
<span class="w">            </span><span class="nt">&quot;log_meta&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;true&quot;</span><span class="p">,</span>
<span class="w">            </span><span class="nt">&quot;log_data&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;true&quot;</span><span class="p">,</span>
<span class="w">            </span><span class="nt">&quot;bucket_index_max_shards&quot;</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span>
<span class="w">            </span><span class="nt">&quot;read_only&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;false&quot;</span>
<span class="w">        </span><span class="p">},</span>
<span class="w">        </span><span class="p">{</span>
<span class="w">            </span><span class="nt">&quot;id&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;d1024e59-7d28-49d1-8222-af101965a939&quot;</span><span class="p">,</span>
<span class="w">            </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;us-west&quot;</span><span class="p">,</span>
<span class="w">            </span><span class="nt">&quot;endpoints&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span>
<span class="w">                </span><span class="s2">&quot;http:\/\/rgw2:80&quot;</span>
<span class="w">            </span><span class="p">],</span>
<span class="w">            </span><span class="nt">&quot;log_meta&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;false&quot;</span><span class="p">,</span>
<span class="w">            </span><span class="nt">&quot;log_data&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;true&quot;</span><span class="p">,</span>
<span class="w">            </span><span class="nt">&quot;bucket_index_max_shards&quot;</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span>
<span class="w">            </span><span class="nt">&quot;read_only&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;false&quot;</span>
<span class="w">        </span><span class="p">}</span>
<span class="w">    </span><span class="p">],</span>
<span class="w">    </span><span class="nt">&quot;placement_targets&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span>
<span class="w">        </span><span class="p">{</span>
<span class="w">            </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;default-placement&quot;</span><span class="p">,</span>
<span class="w">            </span><span class="nt">&quot;tags&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[]</span>
<span class="w">        </span><span class="p">}</span>
<span class="w">    </span><span class="p">],</span>
<span class="w">    </span><span class="nt">&quot;default_placement&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;default-placement&quot;</span><span class="p">,</span>
<span class="w">    </span><span class="nt">&quot;realm_id&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;ae031368-8715-4e27-9a99-0c9468852cfe&quot;</span>
<span class="p">}</span>
</pre></div>
</div>
</section>
<section id="id50">
<h4>配置域组<a class="headerlink" href="#id50" title="Permalink to this heading"></a></h4>
<p>定义域组需创建一个 JSON 对象，并指定必需选项。下面是必需选项：</p>
<ol class="arabic simple">
<li><p><code class="docutils literal notranslate"><span class="pre">name</span></code>: 域组的名字，必需。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">api_name</span></code>: 域组的 API 名字，可选。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">is_master</span></code>: 决定此域组是否为主域组，必需。
<strong>注意：</strong> 一套系统只能有一个主域组。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">endpoints</span></code>: 此域组可服务的终结点列表，例如，你可以让多个域名指向同一域组。记得转义正斜线（ <code class="docutils literal notranslate"><span class="pre">\/</span></code> ）。每个终结点都可以分别指定端口（ <code class="docutils literal notranslate"><span class="pre">fqdn:port</span></code> ）。可选参数。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">hostnames</span></code>: 域组内所有主机名的列表，例如，
你可以让多个域名指向同一域组。可选参数。
<code class="docutils literal notranslate"><span class="pre">rgw</span> <span class="pre">dns</span> <span class="pre">name</span></code> 选项会自动包含在这个列表内，
更改此选项后需重启网关进程。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">master_zone</span></code>: 域组的主域，不指定则为默认域，可选参数。<strong>注意：</strong>每个域组只能有一个主域。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">zones</span></code>: 域组内所有域的列表，每个域需包含其名字（必需）、终结点列表（可选）、以及网关是否需记录元数据和数据操作（默认为否）。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">placement_targets</span></code>: 归置靶列表（可选），
每个归置靶需包含其名字（必需）、和一个标签列表（可选），
只有打了这些标签的用户才可以使用这个归置靶
（即用户信息里的 <code class="docutils literal notranslate"><span class="pre">placement_tags</span></code> 字段）。</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">default_placement</span></code>: 对象索引和对象数据的默认归置靶，
默认为 <code class="docutils literal notranslate"><span class="pre">default-placement</span></code> 。
你也可以为每个用户分别设置它们自己的默认归置靶，设置在用户信息里。</p></li>
</ol>
</section>
<section id="id51">
<h4>配置域组 - 步骤<a class="headerlink" href="#id51" title="Permalink to this heading"></a></h4>
<ol class="arabic">
<li><p>要配置域组，需创建一个包含必需字段的 JSON 对象，并存入文件
（例如 <code class="docutils literal notranslate"><span class="pre">zonegroup.json</span></code> ），然后执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span><span class="nb">set</span><span class="w"> </span>--infile<span class="w"> </span>zonegroup.json</span>
</pre></div></div><p>其中 <code class="docutils literal notranslate"><span class="pre">zonegroup.json</span></code> 是刚刚创建的 JSON 文件。</p>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>名为 <code class="docutils literal notranslate"><span class="pre">default</span></code> 的域组其 <code class="docutils literal notranslate"><span class="pre">is_master</span></code> 选项的值默认是 <code class="docutils literal notranslate"><span class="pre">true</span></code> 。
如果你要新建域组并让它成为主域组，必须把域组 <code class="docutils literal notranslate"><span class="pre">default</span></code> 的
<code class="docutils literal notranslate"><span class="pre">is_master</span></code> 选项设置为 <code class="docutils literal notranslate"><span class="pre">false</span></code> ，或者删除域组 <code class="docutils literal notranslate"><span class="pre">default</span></code> 。</p>
</div>
</li>
<li><p>更新 period ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></li>
</ol>
</section>
<section id="id52">
<h4>配置域组映射图<a class="headerlink" href="#id52" title="Permalink to this heading"></a></h4>
<p>配置域组映射图的过程包括： (1) 创建一个包含一或多个域组的 JSON 对象，
(2) 设置集群的 <code class="docutils literal notranslate"><span class="pre">master_zonegroup</span></code> 。域组映射图里的每个域组都包含一个键值对，
其中 <code class="docutils literal notranslate"><span class="pre">key</span></code> 选项相当于单个域组配置里的 <code class="docutils literal notranslate"><span class="pre">name</span></code> 选项，
<code class="docutils literal notranslate"><span class="pre">val</span></code> 是包含着整个域组配置的 JSON 对象。</p>
<p>你只能有一个 <code class="docutils literal notranslate"><span class="pre">is_master</span></code> 为 <code class="docutils literal notranslate"><span class="pre">true</span></code> 的域组，而且它必须是域组映射图尾部
<code class="docutils literal notranslate"><span class="pre">master_zonegroup</span></code> 选项的值。下面是默认域组映射图的一个实例：</p>
<div class="highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span>
<span class="w">    </span><span class="nt">&quot;zonegroups&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span>
<span class="w">        </span><span class="p">{</span>
<span class="w">            </span><span class="nt">&quot;key&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;90b28698-e7c3-462c-a42d-4aa780d24eda&quot;</span><span class="p">,</span>
<span class="w">            </span><span class="nt">&quot;val&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span>
<span class="w">                </span><span class="nt">&quot;id&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;90b28698-e7c3-462c-a42d-4aa780d24eda&quot;</span><span class="p">,</span>
<span class="w">                </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;us&quot;</span><span class="p">,</span>
<span class="w">                </span><span class="nt">&quot;api_name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;us&quot;</span><span class="p">,</span>
<span class="w">                </span><span class="nt">&quot;is_master&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;true&quot;</span><span class="p">,</span>
<span class="w">                </span><span class="nt">&quot;endpoints&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span>
<span class="w">                    </span><span class="s2">&quot;http:\/\/rgw1:80&quot;</span>
<span class="w">                </span><span class="p">],</span>
<span class="w">                </span><span class="nt">&quot;hostnames&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span>
<span class="w">                </span><span class="nt">&quot;hostnames_s3website&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[],</span>
<span class="w">                </span><span class="nt">&quot;master_zone&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;9248cab2-afe7-43d8-a661-a40bf316665e&quot;</span><span class="p">,</span>
<span class="w">                </span><span class="nt">&quot;zones&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span>
<span class="w">                    </span><span class="p">{</span>
<span class="w">                        </span><span class="nt">&quot;id&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;9248cab2-afe7-43d8-a661-a40bf316665e&quot;</span><span class="p">,</span>
<span class="w">                        </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;us-east&quot;</span><span class="p">,</span>
<span class="w">                        </span><span class="nt">&quot;endpoints&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span>
<span class="w">                            </span><span class="s2">&quot;http:\/\/rgw1&quot;</span>
<span class="w">                        </span><span class="p">],</span>
<span class="w">                        </span><span class="nt">&quot;log_meta&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;true&quot;</span><span class="p">,</span>
<span class="w">                        </span><span class="nt">&quot;log_data&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;true&quot;</span><span class="p">,</span>
<span class="w">                        </span><span class="nt">&quot;bucket_index_max_shards&quot;</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span>
<span class="w">                        </span><span class="nt">&quot;read_only&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;false&quot;</span>
<span class="w">                    </span><span class="p">},</span>
<span class="w">                    </span><span class="p">{</span>
<span class="w">                        </span><span class="nt">&quot;id&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;d1024e59-7d28-49d1-8222-af101965a939&quot;</span><span class="p">,</span>
<span class="w">                        </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;us-west&quot;</span><span class="p">,</span>
<span class="w">                        </span><span class="nt">&quot;endpoints&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span>
<span class="w">                            </span><span class="s2">&quot;http:\/\/rgw2:80&quot;</span>
<span class="w">                        </span><span class="p">],</span>
<span class="w">                        </span><span class="nt">&quot;log_meta&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;false&quot;</span><span class="p">,</span>
<span class="w">                        </span><span class="nt">&quot;log_data&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;true&quot;</span><span class="p">,</span>
<span class="w">                        </span><span class="nt">&quot;bucket_index_max_shards&quot;</span><span class="p">:</span><span class="w"> </span><span class="mi">0</span><span class="p">,</span>
<span class="w">                        </span><span class="nt">&quot;read_only&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;false&quot;</span>
<span class="w">                    </span><span class="p">}</span>
<span class="w">                </span><span class="p">],</span>
<span class="w">                </span><span class="nt">&quot;placement_targets&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span>
<span class="w">                    </span><span class="p">{</span>
<span class="w">                        </span><span class="nt">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;default-placement&quot;</span><span class="p">,</span>
<span class="w">                        </span><span class="nt">&quot;tags&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[]</span>
<span class="w">                    </span><span class="p">}</span>
<span class="w">                </span><span class="p">],</span>
<span class="w">                </span><span class="nt">&quot;default_placement&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;default-placement&quot;</span><span class="p">,</span>
<span class="w">                </span><span class="nt">&quot;realm_id&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;ae031368-8715-4e27-9a99-0c9468852cfe&quot;</span>
<span class="w">            </span><span class="p">}</span>
<span class="w">        </span><span class="p">}</span>
<span class="w">    </span><span class="p">],</span>
<span class="w">    </span><span class="nt">&quot;master_zonegroup&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;90b28698-e7c3-462c-a42d-4aa780d24eda&quot;</span><span class="p">,</span>
<span class="w">    </span><span class="nt">&quot;bucket_quota&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span>
<span class="w">        </span><span class="nt">&quot;enabled&quot;</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span>
<span class="w">        </span><span class="nt">&quot;max_size_kb&quot;</span><span class="p">:</span><span class="w"> </span><span class="mi">-1</span><span class="p">,</span>
<span class="w">        </span><span class="nt">&quot;max_objects&quot;</span><span class="p">:</span><span class="w"> </span><span class="mi">-1</span>
<span class="w">    </span><span class="p">},</span>
<span class="w">    </span><span class="nt">&quot;user_quota&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span>
<span class="w">        </span><span class="nt">&quot;enabled&quot;</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span>
<span class="w">        </span><span class="nt">&quot;max_size_kb&quot;</span><span class="p">:</span><span class="w"> </span><span class="mi">-1</span><span class="p">,</span>
<span class="w">        </span><span class="nt">&quot;max_objects&quot;</span><span class="p">:</span><span class="w"> </span><span class="mi">-1</span>
<span class="w">    </span><span class="p">}</span>
<span class="p">}</span>
</pre></div>
</div>
<ol class="arabic">
<li><p>要配置域组映射图，执行下列命令：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1"><span class="w">  </span>radosgw-admin<span class="w"> </span>zonegroup-map<span class="w"> </span><span class="nb">set</span><span class="w"> </span>--infile<span class="w"> </span>zonegroupmap.json</span>
<span class="prompt1"></span>
<span class="prompt1">其中<span class="w"> </span><span class="sb">``</span>zonegroupmap.json<span class="sb">``</span><span class="w"> </span>是你创建的<span class="w"> </span>JSON<span class="w"> </span>文件，</span>
<span class="prompt1">需确保域组映射图里的域都已创建。</span>
</pre></div></div></li>
<li><p>更新 period ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></li>
</ol>
</section>
</section>
<section id="radosgw-zones">
<span id="id53"></span><h3>域<a class="headerlink" href="#radosgw-zones" title="Permalink to this heading"></a></h3>
<p>域定义的是一或多个 Ceph 对象网关例程的逻辑分组。在某一个域中，
所有 RGW 都可以提供 S3 对象服务，这些 S3 对象底层是 RADOS 对象，
这些 RADOS 对象存储在同一集群的同一组存储池中。Ceph 对象网关组成了域。</p>
<p>域的配置不同于典型配置过程，因为有些配置不在 Ceph 配置文件里。</p>
<p>你可以罗列域、查看或修改域配置。</p>
<section id="id54">
<h4>创建域<a class="headerlink" href="#id54" title="Permalink to this heading"></a></h4>
<p>创建域时，需指定其名字。如果创建的是主域，得加上 <code class="docutils literal notranslate"><span class="pre">--master</span></code> 选项，
一个域组只能有一个主域；若要把域加入域组，
需加上 <code class="docutils literal notranslate"><span class="pre">--rgw-zonegroup</span></code> 选项和域组名字。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>create<span class="w"> </span>--rgw-zone<span class="o">=</span>&lt;name&gt;<span class="w"> </span><span class="se">\</span>
<span class="w">                 </span><span class="o">[</span>--zonegroup<span class="o">=</span>&lt;zonegroup-name<span class="o">]</span><span class="se">\</span>
<span class="w">                 </span><span class="o">[</span>--endpoints<span class="o">=</span>&lt;endpoint&gt;<span class="o">[</span>,&lt;endpoint&gt;<span class="o">]</span><span class="w"> </span><span class="se">\</span>
<span class="w">                 </span><span class="o">[</span>--master<span class="o">]</span><span class="w"> </span><span class="o">[</span>--default<span class="o">]</span><span class="w"> </span><span class="se">\</span>
<span class="w">                 </span>--access-key<span class="w"> </span><span class="nv">$SYSTEM_ACCESS_KEY</span><span class="w"> </span>--secret<span class="w"> </span><span class="nv">$SYSTEM_SECRET_KEY</span></span>
</pre></div></div><p>创建完域之后，更新 period ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></section>
<section id="id55">
<h4>删除域<a class="headerlink" href="#id55" title="Permalink to this heading"></a></h4>
<p>删除域前，要先从域组删掉：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zonegroup<span class="w"> </span>remove<span class="w"> </span>--zonegroup<span class="o">=</span>&lt;name&gt;<span class="se">\</span>
<span class="w">                                  </span>--zone<span class="o">=</span>&lt;name&gt;</span>
</pre></div></div><p>然后，更新 period ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div><p>接下来，删除这个域：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>delete<span class="w"> </span>--rgw-zone&lt;name&gt;</span>
</pre></div></div><p>最后，更新 period ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div><div class="admonition important">
<p class="admonition-title">Important</p>
<p>从域组删掉域之前先不要删除这个域，
否则更新 period 时会失败。</p>
</div>
<p>域被删除后，如果其它地方也不需要与之相关的存储池，可以考虑删除掉，
把下面实例中的 <code class="docutils literal notranslate"><span class="pre">&lt;del-zone&gt;</span></code> 替换成已删除域的名字即可。</p>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>只能删除以域名打头的存储池。
若删除根存储池（如 <code class="docutils literal notranslate"><span class="pre">.rgw.root</span></code> ），
会删除整个系统的配置。</p>
</div>
<div class="admonition important">
<p class="admonition-title">Important</p>
<p>一旦删除存储池，其内的数据也会被删除，
且不可恢复。所以，确定存储池内容不需要了再删除。</p>
</div>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>&lt;del-zone&gt;.rgw.control<span class="w"> </span>&lt;del-zone&gt;.rgw.control<span class="w"> </span>--yes-i-really-really-mean-it</span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>&lt;del-zone&gt;.rgw.meta<span class="w"> </span>&lt;del-zone&gt;.rgw.meta<span class="w"> </span>--yes-i-really-really-mean-it</span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>&lt;del-zone&gt;.rgw.log<span class="w"> </span>&lt;del-zone&gt;.rgw.log<span class="w"> </span>--yes-i-really-really-mean-it</span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>&lt;del-zone&gt;.rgw.otp<span class="w"> </span>&lt;del-zone&gt;.rgw.otp<span class="w"> </span>--yes-i-really-really-mean-it</span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>&lt;del-zone&gt;.rgw.buckets.index<span class="w"> </span>&lt;del-zone&gt;.rgw.buckets.index<span class="w"> </span>--yes-i-really-really-mean-it</span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>&lt;del-zone&gt;.rgw.buckets.non-ec<span class="w"> </span>&lt;del-zone&gt;.rgw.buckets.non-ec<span class="w"> </span>--yes-i-really-really-mean-it</span>
<span class="prompt1">ceph<span class="w"> </span>osd<span class="w"> </span>pool<span class="w"> </span>rm<span class="w"> </span>&lt;del-zone&gt;.rgw.buckets.data<span class="w"> </span>&lt;del-zone&gt;.rgw.buckets.data<span class="w"> </span>--yes-i-really-really-mean-it</span>
</pre></div></div></section>
<section id="id56">
<h4>修改域配置<a class="headerlink" href="#id56" title="Permalink to this heading"></a></h4>
<p>修改域配置需指定域名、以及你想更改的参数。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>modify<span class="w"> </span><span class="o">[</span>options<span class="o">]</span></span>
</pre></div></div><p>其中 <code class="docutils literal notranslate"><span class="pre">[options]</span></code> 可以是：</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">--access-key=&lt;key&gt;</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--secret</span> <span class="pre">或</span> <span class="pre">--secret-key=&lt;key&gt;</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--master</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--default</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">--endpoints=&lt;list&gt;</span></code></p></li>
</ul>
<p>然后，更新 period ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></section>
<section id="id57">
<h4>罗列域<a class="headerlink" href="#id57" title="Permalink to this heading"></a></h4>
<p>以 <code class="docutils literal notranslate"><span class="pre">root</span></code> 身份罗列集群中的域：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>list</span>
</pre></div></div></section>
<section id="id58">
<h4>查看域<a class="headerlink" href="#id58" title="Permalink to this heading"></a></h4>
<p>以 <code class="docutils literal notranslate"><span class="pre">root</span></code> 身份查看某个域的配置：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>get<span class="w"> </span><span class="o">[</span>--rgw-zone<span class="o">=</span>&lt;zone&gt;<span class="o">]</span></span>
</pre></div></div><p><code class="docutils literal notranslate"><span class="pre">default</span></code> 这个域的配置长相如下：</p>
<div class="highlight-json notranslate"><div class="highlight"><pre><span></span><span class="p">{</span><span class="w"> </span><span class="nt">&quot;domain_root&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;.rgw&quot;</span><span class="p">,</span>
<span class="w">  </span><span class="nt">&quot;control_pool&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;.rgw.control&quot;</span><span class="p">,</span>
<span class="w">  </span><span class="nt">&quot;gc_pool&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;.rgw.gc&quot;</span><span class="p">,</span>
<span class="w">  </span><span class="nt">&quot;log_pool&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;.log&quot;</span><span class="p">,</span>
<span class="w">  </span><span class="nt">&quot;intent_log_pool&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;.intent-log&quot;</span><span class="p">,</span>
<span class="w">  </span><span class="nt">&quot;usage_log_pool&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;.usage&quot;</span><span class="p">,</span>
<span class="w">  </span><span class="nt">&quot;user_keys_pool&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;.users&quot;</span><span class="p">,</span>
<span class="w">  </span><span class="nt">&quot;user_email_pool&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;.users.email&quot;</span><span class="p">,</span>
<span class="w">  </span><span class="nt">&quot;user_swift_pool&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;.users.swift&quot;</span><span class="p">,</span>
<span class="w">  </span><span class="nt">&quot;user_uid_pool&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;.users.uid&quot;</span><span class="p">,</span>
<span class="w">  </span><span class="nt">&quot;system_key&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nt">&quot;access_key&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;&quot;</span><span class="p">,</span><span class="w"> </span><span class="nt">&quot;secret_key&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;&quot;</span><span class="p">},</span>
<span class="w">  </span><span class="nt">&quot;placement_pools&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">[</span>
<span class="w">      </span><span class="p">{</span><span class="w">  </span><span class="nt">&quot;key&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;default-placement&quot;</span><span class="p">,</span>
<span class="w">         </span><span class="nt">&quot;val&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="nt">&quot;index_pool&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;.rgw.buckets.index&quot;</span><span class="p">,</span>
<span class="w">                  </span><span class="nt">&quot;data_pool&quot;</span><span class="p">:</span><span class="w"> </span><span class="s2">&quot;.rgw.buckets&quot;</span><span class="p">}</span>
<span class="w">      </span><span class="p">}</span>
<span class="w">    </span><span class="p">]</span>
<span class="w">  </span><span class="p">}</span>
</pre></div>
</div>
</section>
<section id="id59">
<h4>配置域<a class="headerlink" href="#id59" title="Permalink to this heading"></a></h4>
<p>配置域时需指定一系列 Ceph 对象网关例程的存储池，考虑到一致性，我们建议用域的名字作为存储池前缀。存储池如何配置见<a class="reference external" href="http://docs.ceph.com/en/latest/rados/operations/pools/#pools">存储池</a> 。</p>
<p>要配置域，需创建一个包含存储池的 JSON 对象，并存入一个文件
（如 <code class="docutils literal notranslate"><span class="pre">zone.json</span></code> ），然后执行下列命令，把 <code class="docutils literal notranslate"><span class="pre">{zone-name}</span></code> 替换为域的名字：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span><span class="nb">set</span><span class="w"> </span>--rgw-zone<span class="o">={</span>zone-name<span class="o">}</span><span class="w"> </span>--infile<span class="w"> </span>zone.json</span>
</pre></div></div><p>其中 <code class="docutils literal notranslate"><span class="pre">zone.json</span></code> 是你创建的 JSON 文件。</p>
<p>然后，以 <code class="docutils literal notranslate"><span class="pre">root</span></code> 用户身份更新 period ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></section>
<section id="id60">
<h4>重命名域<a class="headerlink" href="#id60" title="Permalink to this heading"></a></h4>
<p>要重命名域，需指定域的名字和新的域名。</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>zone<span class="w"> </span>rename<span class="w"> </span>--rgw-zone<span class="o">=</span>&lt;name&gt;<span class="w"> </span>--zone-new-name<span class="o">=</span>&lt;name&gt;</span>
</pre></div></div><p>然后，更新 period ：</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span class="prompt1">radosgw-admin<span class="w"> </span>period<span class="w"> </span>update<span class="w"> </span>--commit</span>
</pre></div></div></section>
</section>
<section id="id61">
<h3>域组和域选项<a class="headerlink" href="#id61" title="Permalink to this heading"></a></h3>
<p>配置默认的域组和域时，存储池名字里包含域的名字，
例如：</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">default.rgw.control</span></code></p></li>
</ul>
<p>要更改默认值，把下列选项写入 Ceph 配置文件里 <code class="docutils literal notranslate"><span class="pre">[client.radosgw.{instance-name}]</span></code> 例程配置段下面。</p>
<table class="docutils align-default">
<thead>
<tr class="row-odd"><th class="head"><p>名字</p></th>
<th class="head"><p>描述</p></th>
<th class="head"><p>类型</p></th>
<th class="head"><p>默认值</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">rgw_zone</span></code></p></td>
<td><p>配置在网关例程上的域的名字。</p></td>
<td><p>String</p></td>
<td><p>None</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">rgw_zonegroup</span></code></p></td>
<td><p>配置在网关例程上的域组名。</p></td>
<td><p>String</p></td>
<td><p>None</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">rgw_zonegroup_root_pool</span></code></p></td>
<td><p>域组的根存储池。</p></td>
<td><p>String</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">.rgw.root</span></code></p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">rgw_zone_root_pool</span></code></p></td>
<td><p>域的根存储池。</p></td>
<td><p>String</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">.rgw.root</span></code></p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">rgw_default_zone_group_info_oid</span></code></p></td>
<td><p>用于存储默认域组的 OID 。
我们不建更改此选项。</p></td>
<td><p>String</p></td>
<td><p><code class="docutils literal notranslate"><span class="pre">default.zonegroup</span></code></p></td>
</tr>
</tbody>
</table>
</section>
</section>
</section>



<div id="support-the-ceph-foundation" class="admonition note">
  <p class="first admonition-title">Brought to you by the Ceph Foundation</p>
  <p class="last">The Ceph Documentation is a community resource funded and hosted by the non-profit <a href="https://ceph.io/en/foundation/">Ceph Foundation</a>. If you would like to support this and our other efforts, please consider <a href="https://ceph.io/en/foundation/join/">joining now</a>.</p>
</div>


           </div>
           
          </div>
          <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer">
        <a href="../frontends/" class="btn btn-neutral float-left" title="HTTP 前端" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a>
        <a href="../zone-features/" class="btn btn-neutral float-right" title="Zone Features" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right" aria-hidden="true"></span></a>
    </div>

  <hr/>

  <div role="contentinfo">
    <p>&#169; Copyright 2016, Ceph authors and contributors. Licensed under Creative Commons Attribution Share Alike 3.0 (CC-BY-SA-3.0).</p>
  </div>

   

</footer>
        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>